// 链表无法随机访问，只能从head开始一个一个节点查找
const {ListNode, LinkedList}  = require('./1. 建立线性链表')
function find(linkedList, val) {
    let cur = linkedList.head
    while (cur) {
        if (val === cur.val) {
            return cur
        }
        cur = cur.next
    }
    return null
}
console.log(find(new LinkedList([2,3,5,6,8,1]), 1));